package com.yyf.springboot2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yyf.springboot2.entity.TArticle;
import com.yyf.springboot2.mapper.TArticleMapper;
import com.yyf.springboot2.mapper.TGoodsMapper;
import com.yyf.springboot2.service.TArticleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yyf
 * @since 2019-05-29
 */
@Service
@Transactional

public class TArticleServiceImpl extends ServiceImpl<TArticleMapper, TArticle> implements TArticleService {

    @Resource
    private TArticleMapper articleMapper;
    @Override
    public List<TArticle> getArticleListBySmallId(Integer id, Integer pageSize, Integer pageNum) {
        return null;
    }

    @Override
    public  List <TArticle> getindexArt(Integer pageSize) {
        QueryWrapper<TArticle> queryWrapper = new QueryWrapper <>();
        if(pageSize != null){
            queryWrapper.last("order by sort asc limit 0,"+pageSize);
        }
        return   articleMapper.selectList(queryWrapper);
    }
}
